The present invention relates to a device and a method for controlling a motor based on a current flowing through the motor.
As a method for controlling the speed of a motor, the pulse width modulation (PWM) controlling is known. Such technique is described in, for example, Japanese Laid-Open Patent Publication No. 6-237591. More specifically, a PWM control signal is supplied to a field effect transistor (FET), which supplies a drive current to the motor, such that the FET is selectively turned on or off. A resistor is connected in series with the motor for detecting a current flowing through the motor. The detection is achieved by sampling and holding the current flowing through the motor for a time sufficiently shorter than the time for which the PWM control signal remains activated. The timing for sampling and holding the motor current is set at the middle of the activation time of the PWM control signal. The duty ratio of the PWM control signal is adjusted such that the detected current becomes constant.
While the PWM control signal is altered in a pulse-like manner, the current flowing through the motor is varied relatively moderately, as compared to the PWM control signal. Therefore, if the sampling and holding of the motor current is started at the aforementioned timing, which corresponds to the middle of the activation time of the PWM control signal, the sampling and holding may be completed prematurely, or before the motor current becomes sufficiently large. If this is the case, the detected current may become smaller than the actual value.
Further, a motor control device with an overcurrent protecting function is also generally known. The control device judges whether or not the drive current supplied to the motor is an overcurrent. If the judgment is positive, the device suspends the current supply to the motor for protecting the motor from seizure, which is otherwise caused by the overcurrent.
In this device, if sampling and holding of the motor current is performed at the aforementioned timing, which corresponds to the middle of the activation time of the PWM control signal, the premature current detection may hamper the overcurrent protecting function.
In order to solve this problem, sampling and holding of the motor current may be started at a timing corresponding to a trailing edge of the PWM control signal. In this case, the detected current becomes sufficiently large. Further, at this timing, it is relatively easy to start the sampling and holding of the motor current.
However, since the motor current is varied relatively greatly following the trailing edge of the PWM control signal, the detected current may be inaccurate. This also hampers the overcurrent protecting function.